package javacafe.action.member;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import javacafe.action.Action;
import javacafe.action.ActionForward;
import javacafe.daoimpl.MemberDAOImple;
import javacafe.dto.member.MemberDTO;
import javacafe.serviceimple.MemberServiceImple;

public class CustUpdateAction implements Action {
	
	private static Logger log = Logger.getLogger(CustUpdateAction.class);

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		
		ActionForward actfoward = new ActionForward();
		MemberServiceImple service = MemberServiceImple.getInstance();
				
		String m_id = request.getParameter("id");
		String m_password = request.getParameter("pass");
		String m_name = request.getParameter("name");
		String m_address = request.getParameter("address");
		String m_email = request.getParameter("email");
		String m_phone = request.getParameter("phone");
		String m_intro = request.getParameter("intro");
		String m_pic = request.getParameter("pic");
		String m_birth = request.getParameter("birthday");
		
		MemberDTO dto = new MemberDTO();
				
		dto.setM_id(m_id);
		dto = service.getMember(dto);
				
		dto.setM_password(m_password);
		dto.setM_name(m_name);
		dto.setM_address(m_address);
		dto.setM_email(m_email);
		dto.setM_phone(m_phone);
		dto.setM_intro(m_intro);
		dto.setM_pic(m_pic);
		dto.setM_birth(m_birth);		
				
		service.updateMember(dto);		
		actfoward.setUrl("index");
		
		return actfoward;
	}

}
